<template>
  <div class="main">
    <div class="left">
      <studentMainleft></studentMainleft>
    </div>
    <div class="right">
      <div class="title">
        <el-button type="primary" @click="dialogFormVisible = true">添加职工</el-button>
      </div>
      <template>
        <el-table :data="worderList" style="width: 100%">
          <el-table-column prop="WorkerName" label="职工姓名" width="180"></el-table-column>
          <el-table-column prop="WorkerId" label="职工编号" width="180"></el-table-column>
          <el-table-column prop="WorkerPhone" label="职工电话"></el-table-column>
          <el-table-column prop="WorkerAge" label="职工年龄"></el-table-column>
          <el-table-column prop="WorkerSex" label="职工性别"></el-table-column>
          <el-table-column prop="WorkerEmail" label="职工邮箱"></el-table-column>
          <el-table-column prop="WorkerCarid" label="职工身份证"></el-table-column>
          <el-table-column prop="WorkerLocal" label="职工籍贯"></el-table-column>
        </el-table>
      </template>
    </div>
    <el-dialog title="添加职工" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item label="职工姓名">
          <el-input v-model="form.WorkerName" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="职工年龄">
          <el-input v-model="form.WorkerAge" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="职工性别">
          <el-input v-model="form.WorkerSex" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="职工身份证">
          <el-input v-model="form.WorkerCarid" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="职工电话">
          <el-input v-model="form.WorkerPhone" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="职工籍贯">
          <el-input v-model="form.WorkerLocal" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="职工入职时间">
          <el-input v-model="form.Workerbacktime" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="电子邮件">
          <el-input v-model="form.WorkerEmail" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <el-button type="primary" @click="addworker">主要按钮</el-button>
    </el-dialog>
  </div>
</template>

<script>
import studentMainleft from "@/components/studentMainleft";
export default {
  components: {
    studentMainleft
  },
  data() {
    return {
      form: {
        id: 0,
        WorkerName: "",
        WorkerAge: "",
        WorkerSex: "",
        WorkerCarid: "",
        WorkerPhone: "",
        PositionId: "3",
        WorkerLocal: "",
        Workerbacktime: "",
        WorkerEmail: ""
      },
      dialogFormVisible: false,
      worderList: []
    };
  },
  created() {
    this.GetAllWorker();
  },
  mounted() {},
  methods: {
    addworker() {
      console.log(this.form);
      //   this.$axios({
      //    method:'post',
      //    url:this.$api.InsertWorker,
      //   data:{},
      //   params:{},
      //    }).then((res)=>{
      //    console.log(res)
      //   })
    },
    GetAllWorker() {
      this.$axios({
        method: "get",
        url: this.$api.GetAllWorker,
        data: {},
        params: {}
      }).then(res => {
        console.log(res);
        this.worderList = res.data.message;
      });
    }
  }
};
</script>

<style scoped>
.main {
  display: flex;
  height: 100%;
}
.right {
  width: 100%;
  background-color: white;
  height: 80%;
  margin-left: 10px;
  padding: 0px 20px 0 20px;
}
</style>
